package com.fjut.pms.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.fjut.pms.dao.IBaseDao;
import com.fjut.pms.pojo.Pay;
import com.fjut.pms.service.IPayService;
import com.fjut.pms.utils.PageBean;

public class PayServiceImpl implements IPayService {
	private IBaseDao payDao;

	public PageBean findPay(PageBean page, int id) {
		String hql = "from Pay pay where 1=1 ";
		String countHql="select count(*) from Pay pay where 1=1";
		Map<String, Object> map = new HashMap<String, Object>();
		if(id!=0){
			 hql+="and employee_id=:id"; 
			 countHql+="and employee_id=:id";
			 map.put("id",id);
		}
		return payDao.findPageByHql(page.getPageNo(), page.getPageSize(), hql, countHql, map);
	}

	public IBaseDao getPayDao() {
		return payDao;
	}

	public void setPayDao(IBaseDao payDao) {
		this.payDao = payDao;
	}

	public void save(Pay pay) {
		payDao.saveOrUpdate(pay);
	}

	public List count() {
		payDao.findListByHql("from Pay pay");
		return null;
	}

}
